// Copyright(C) Japan Android Group Gunma
// LGPL License
// Writers Rabbit-U

package jp.android_group.gunma.gunma_app_lib;

import jp.android_group.gunma.gunma_app_lib.R;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class Main extends Activity {

	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        {
        	Button v = (Button)findViewById(R.id.ButtonCity);
        	v.setOnClickListener(new OnClickListener() {

				public void onClick(View v) {
					Intent intent = new Intent(Main.this, CityActivity.class);
					startActivity(intent);
				}
        		
        	});
        }
        
        {
        	Button v = (Button)findViewById(R.id.ButtonDocomo);
        	v.setOnClickListener(new OnClickListener() {

				public void onClick(View v) {
					searchShop("ドコモショップ");
				}
        		
        	});
        }

        {
        	Button v = (Button)findViewById(R.id.ButtonSoftBank);
        	v.setOnClickListener(new OnClickListener() {

				public void onClick(View v) {
					searchShop("ソフトバンク");
				}
        		
        	});
        }

        {
        	Button v = (Button)findViewById(R.id.ButtonAu);
        	v.setOnClickListener(new OnClickListener() {

				public void onClick(View v) {
					searchShop("auショップ");
				}
        		
        	});
        }

        {
        	Button v = (Button)findViewById(R.id.ButtonEMobile);
        	v.setOnClickListener(new OnClickListener() {

				public void onClick(View v) {
					searchShop("イー･モバイル ");
				}
        		
        	});
        }

    }
    
    void searchShop(String name) {
		Intent intent = new Intent();
		intent.setAction(Intent.ACTION_VIEW);
		intent.addCategory(Intent.CATEGORY_DEFAULT);
		intent.addCategory(Intent.CATEGORY_BROWSABLE);
		String textUri = "http://maps.google.com/maps?q=" + name;
		Uri uri = Uri.parse(textUri);
		intent.setData(uri);
		startActivity(intent);
    }
    
}